﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;

namespace AsTekMobile
{
    static class Program
    {
        public static Sessions Session = null;

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [MTAThread]
        static void Main()
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;
            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);

            Session = Sessions.CreateSession;
            if (!File.Exists(Methods.StartupPath() + "\\ayarlar.ini"))
            {
                using (frmAyar set = new frmAyar())
                {
                    set.ShowDialog();
                }
            }
            frmLogin gir = new frmLogin();
            if (gir.ShowDialog() == DialogResult.OK)
                Application.Run(new frmMain(gir.GuncellemeSuresi));
        }

        static void MyHandler(object sender, UnhandledExceptionEventArgs args)
        {
            Exception e = (Exception)args.ExceptionObject;
            ErrorMgr.Opps(e);
        }
    }
}